package org.lele.config;


import com.google.common.collect.Sets;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;


/**
 * Swagger配置类
 * @author lihong
 */
@Configuration
@EnableOpenApi
public class CapitalLeaseSwaggerConfig {

    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.OAS_30)
                .groupName("excel")
                .apiInfo(apiInfo()).enable(true)
                .select()
                //apis： 添加swagger接口提取范围
                .apis(RequestHandlerSelectors.basePackage("org.lele.controller"))
                //.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//                .paths(PathSelectors.ant("/residentmanage-dev/dataDict/**"))
                .paths(PathSelectors.any())
                .build()
                .protocols(Sets.newHashSet("http", "https"));
    }


    private ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("文件处理API文档")
                .description("文件处理")
                .contact(new Contact("fyl", "", ""))
                .version("1.0")
                .build();
    }
}
